/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author TQNINH
 */
public class BloodReservoir {
    private int units;
    private int nSold;
    private int[] soldUnit = new int[100];
    private double cost;
    
    public void setCost(double c) {
        cost = c;
    }
    
    public void setUnit(int u) {
        units = u;
    }
    
    public void setSoldUnit(int n) {
        units -= n; 
        soldUnit[nSold] = n;
        nSold++;
        System.out.println("Success! Sold " + n + " units of blood!");
    }
    
    public double getCost() {
        return cost;
    }
    
    public int getUnit() {
        return units;
    }
    
    public int getTotalUnitSold() {
        int n = 0;
        for(int i = 0;i < nSold;i++) {
            n += soldUnit[i];
        }
        return n;
    }
    
    public void getDetailUnitSold() {
        for(int i = 0;i < nSold;i++) {
            System.out.println("\t- Sold " + (i + 1) + ": " + soldUnit[i]);
        }
        System.out.println("\t- Sold total: " + getTotalUnitSold());
    }
}
